… | |
… | |
99 | */ |
99 | */ |
100 | void |
100 | void |
101 | current_region_info (object *op) |
101 | current_region_info (object *op) |
102 | { |
102 | { |
103 | if (region *reg = op->region ()) |
103 | if (region *reg = op->region ()) |
104 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are in %s.\n%s", reg->longname, ®->msg); |
104 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are in %s.\n%s", ®->longname, ®->msg); |
105 | } |
105 | } |
106 | |
106 | |
107 | void |
107 | void |
108 | current_map_info (object *op) |
108 | current_map_info (object *op) |
109 | { |
109 | { |
… | |
… | |
144 | /* |
144 | /* |
145 | * reset the counter on the region, then use it to store the number of |
145 | * reset the counter on the region, then use it to store the number of |
146 | * players there. |
146 | * players there. |
147 | * I don't know how thread-safe this would be, I suspect not very.... |
147 | * I don't know how thread-safe this would be, I suspect not very.... |
148 | */ |
148 | */ |
149 | for (region *reg = first_region; reg; reg = reg->next) |
149 | for_all_regions (rgn) |
150 | reg->counter = 0; |
150 | rgn->counter = 0; |
151 | |
151 | |
152 | for_all_players (pl) |
152 | for_all_players (pl) |
153 | if (pl->ob->map) |
153 | if (pl->ob->map) |
154 | ++pl->ob->region ()->counter; |
154 | ++pl->ob->region ()->counter; |
155 | |
155 | |
156 | /* we only want to print out by places with a 'longname' field... */ |
156 | /* we only want to print out by places with a 'longname' field... */ |
157 | for (region *reg = first_region; reg; reg = reg->next) |
157 | for_all_regions (rgn) |
158 | { |
158 | { |
159 | if (reg->longname == NULL && reg->counter > 0) |
159 | if (!rgn->longname && rgn->counter > 0) |
160 | { |
160 | { |
161 | if (reg->parent) |
161 | if (rgn->parent) |
162 | { |
162 | { |
163 | reg->parent->counter += reg->counter; |
163 | rgn->parent->counter += rgn->counter; |
164 | reg->counter = 0; |
164 | rgn->counter = 0; |
165 | } |
165 | } |
166 | else /*uh oh, we shouldn't be here. */ |
166 | else /*uh oh, we shouldn't be here. */ |
167 | LOG (llevError, "command_whereabouts() Region %s with no longname has no parent", ®->name); |
167 | LOG (llevError, "command_whereabouts() Region %s with no longname has no parent", &rgn->name); |
168 | } |
168 | } |
169 | } |
169 | } |
170 | |
170 | |
171 | new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:"); |
171 | new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:"); |
172 | |
172 | |
173 | for (region *reg = first_region; reg; reg = reg->next) |
173 | for_all_regions (rgn) |
174 | if (reg->counter) |
174 | if (rgn->counter) |
175 | new_draw_info_format (NDI_UNIQUE, 0, op, "%u players in %s", reg->counter, reg->longname); |
175 | new_draw_info_format (NDI_UNIQUE, 0, op, "%u players in %s", rgn->counter, &rgn->longname); |
176 | |
176 | |
177 | return 1; |
177 | return 1; |
178 | } |
178 | } |
179 | |
179 | |
180 | typedef struct |
180 | typedef struct |