Get rid of line numbers in programs

Bug #536493 reported by Sigra
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

Line numbers were cool in the long gone days of BASIC. Get rid of them in production/worker programs. Instead of:
0=findspace size:any radius:7 resource:fish
1=walk coords
2=playFX fisher_throw_net 192
3=mine fish 1
4=animation idle 3000 # Play a fishing animation
5=playFX fisher_pull_net 192
6=createitem fish
7=return

it should be enough to have:
command=findspace size:any radius:7 resource:fish
command=walk coords
command=playFX fisher_throw_net 192
command=mine fish 1
command=animation idle 3000 # Play a fishing animation
command=playFX fisher_pull_net 192
command=createitem fish
command=return

(Or "cmd" if "command is too long (or "c" if "cmd" is still too long).)

Then it will be possible to reorder and insert commands without renumbering other commands.

Related branches

Revision history for this message
Sigra (sigra) wrote :

Here is a rough patch that implements this for production programs and reworks the whole parsing/executing code (no changes for immovable and worker programs). The command name is the key and the parameter list is the value. This patch gets rit of the set action and the associated program flags. Instead it adds a return statement that can return Completed when the program completes successfully (default if there is no return statement at the end), Failed if something went wrong and Skipped if the program had nothing to do. Only completed and failed program executions should update the statistics. So if a program should not affect the statistics, add "return=skipped" at the end (this was previously done with 0=set +nostats"). The return statement can also be conditional. So far there is one condition supported, Economy_Needs. Thus adding "return=skipped unless economy needs grindstone" will prevent Game Over by stopping the stonegrinder from grinding all available stone. This is actually a form of on-demand production. The parsing has been optimized to eliminate most of the needless string copying. Finishing and tweaking is still to be done.
File Added: production_program_rework-0.1.diff

Revision history for this message
Sigra (sigra) wrote :

File Added: production_program_rework-0.2.diff

Revision history for this message
Sigra (sigra) wrote :

File Added: production_program_rework-0.3.diff

Revision history for this message
Sigra (sigra) wrote :

repaired the encyclopedia window
File Added: production_program_rework-0.4.diff

Revision history for this message
Sigra (sigra) wrote :

File Added: production_program_rework-1.diff

Revision history for this message
Sigra (sigra) wrote :

This was implemented for production programs in revision 3373 (worker and immovable programs remain unfixed).

Revision history for this message
Sigra (sigra) wrote :

This was implemented for immovable programs in revision 3591 (critter_bob and worker programs remain unfixed).

Revision history for this message
Raul Ferriz (raul.ferriz) wrote :

Is this not fully implemented now on trunk?

Changed in widelands:
status: New → In Progress
SirVer (sirver)
Changed in widelands:
importance: High → Low
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Could someone please reply to comment #8 whether this is actually implemented or list the areas (files) still affected.

Changed in widelands:
status: In Progress → Incomplete
Revision history for this message
SirVer (sirver) wrote :

I have no widelands source ready atm, but afaik this is still true (there are line numbers). this can easily be verified by checking for example the conf file for the fisher and his fishing program in it.

I once thought about replacing those programs with lua all together.. this would add a fantastic flexibility, but would require a lot of reworking of existing code. For the moment and since most programs have not been touched for a very long time, I can live with line numbers and see this as a Won't fix or a very, very low priority.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

All right, the fisher still has line numbers. Changing back to Confirmed.

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/tribes/barbarians/fisher/conf

tags: added: gamedata
Changed in widelands:
status: Incomplete → Confirmed
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Checked the link in my comment above. Still line numbers present.

Changed in widelands:
status: Incomplete → Confirmed
tags: added: worker
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
GunChleoc (gunchleoc) wrote :

Lumberjack has it as well

Changed in widelands:
status: Incomplete → Confirmed
Revision history for this message
SirVer (sirver) wrote :

Something with the bug sweeper is either broken, or we are through all bugs once......

Revision history for this message
kaputtnik (franku) wrote :

All these files contain such numberings:

/tribes/barbarians/farmer/conf
/tribes/barbarians/gamekeeper/conf
/tribes/barbarians/ranger/conf
/tribes/barbarians/gardener/conf
/tribes/barbarians/lumberjack/conf
/tribes/barbarians/fisher/conf
/tribes/barbarians/stonemason/conf
/tribes/barbarians/scout/conf
/tribes/barbarians/hunter/conf
/tribes/barbarians/battlearena/conf
/tribes/barbarians/geologist/conf
/tribes/atlanteans/farmer/conf
/tribes/barbarians/shipwright/conf
/tribes/atlanteans/forester/conf
/tribes/atlanteans/woodcutter/conf
/tribes/atlanteans/fisher/conf
/tribes/atlanteans/scout/conf
/tribes/atlanteans/stonecutter/conf
/tribes/atlanteans/hunter/conf
/tribes/atlanteans/fish_breeder/conf
/tribes/atlanteans/geologist/conf
/tribes/atlanteans/blackroot_farmer/conf
/tribes/atlanteans/shipwright/conf
/tribes/empire/farmer/conf
/tribes/empire/vinefarmer/conf
/tribes/empire/trainingcamp/conf
/tribes/empire/forester/conf
/tribes/empire/fisher/conf
/tribes/empire/stonemason/conf
/tribes/empire/lumberjack/conf
/tribes/empire/hunter/conf
/tribes/empire/scout/conf
/tribes/empire/geologist/conf
/tribes/empire/shipwright/conf

Revision history for this message
GunChleoc (gunchleoc) wrote :

They should all be gone in the one_tribe branch, but it can't hurt to double-check before we merge it.

Changed in widelands:
status: Confirmed → In Progress
assignee: nobody → GunChleoc (gunchleoc)
milestone: none → build19-rc1
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
assignee: GunChleoc (gunchleoc) → nobody
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.